extends /templates/core/modal-base-flat

block modal-header-content
  if view.classroom.isNew()
    h3.modal-title(data-i18n="courses.create_new_class")
  else
    h3.modal-title(data-i18n="courses.edit_settings1")

block modal-body-content
  form
    .form-group
      label(data-i18n="courses.class_name")
      input#name-input.form-control(name="name" type='text' value=view.classroom.get('name'))
      
    .form-group
      label
        span(data-i18n="general.description")
        i.spl.text-muted(data-i18n="signup.optional")
      textarea.form-control(name="description" rows=2)= view.classroom.get('description')
      
    .form-group
      label(data-i18n="choose_hero.programming_language")
      - var aceConfig = view.classroom.get('aceConfig') || {};
      - var languageDisabled = !!_.size(view.classroom.get('members'));
      .help-block.small.text-navy(data-i18n="courses.language_cannot_change")
      select#programming-language-select.form-control(name="language" value=aceConfig.language disabled=languageDisabled)
        - var aceConfig = view.classroom.get('aceConfig') || {};
        option(value="" data-i18n="courses.language_select")
        option(value="python") Python
        option(value="javascript") JavaScript
        
    .form-group
      label
        span(data-i18n="courses.avg_student_exp_label")
        i.spl.text-muted(data-i18n="signup.optional")
      .help-block.small.text-navy(data-i18n="courses.avg_student_exp_desc")
      select.form-control(name="averageStudentExp", value=view.classroom.get('averageStudentExp'))
        option(value="" data-i18n="courses.avg_student_exp_select")
        option(value="none" data-i18n="courses.avg_student_exp_none")
        option(value="beginner" data-i18n="courses.avg_student_exp_beginner")
        option(value="intermediate" data-i18n="courses.avg_student_exp_intermediate")
        option(value="advanced" data-i18n="courses.avg_student_exp_advanced")
        option(value="varied" data-i18n="courses.avg_student_exp_varied")
        
    .form-group
      label
        span(data-i18n="courses.student_age_range_label")
        i.spl.text-muted(data-i18n="signup.optional")
      div
        +ageRange("ageRangeMin")
        span.spl.spr(data-i18n="courses.student_age_range_to")
        +ageRange("ageRangeMax")
        
      mixin ageRange(name)
        select.age-range-select.form-control(name=name value=view.classroom.get(name))
          option(value="") -
          option(value="<6" data-i18n="courses.student_age_range_younger")
          for i in _.range(6,18)
            option(value=i)= i
          option(value="18" data-i18n="courses.student_age_range_older")

    if view.classroom.getSetting('optionsEditable') || me.isAdmin()
      .form-group
        label Student Experience Options
        - var settings = view.schema.properties.settings.properties
        for opt,name in settings
          if name != "optionsEditable" || me.isAdmin()
          .form-group
            div.checkbox
              input(type="checkbox", id="settings_"+name, name="settings/"+name, checked=view.classroom.getSetting(name))
              label(for="settings_" + name)
                span= opt.description
    
block modal-footer-content
  .text-center
    if view.classroom.isNew()
      button#save-settings-btn.btn.btn-primary.btn-lg(data-i18n="courses.create_class")
    else
      button#save-settings-btn.btn.btn-primary.btn-lg(data-i18n="common.save_changes")
      
    if me.isAdmin()
      hr
      // DNT
      h3 Admin Only
      button#update-courses-btn.btn.btn-forest.btn-lg Update Courses
